home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / 3d-outline.scm next >
Encoding:
GIMP Script-Fu Script  |  2005-06-30  |  6.6 KB  |  172 lines

  1. ; 3d-outlined-patterned-shadowed-and-bump-mapped-logo :)
  2. ; creates outlined border of a text with patterns
  3. ;
  4. ; The GIMP -- an image manipulation program
  5. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  6. ;
  7. ; 3d-outline creates outlined border of a text with patterns
  8. ; Copyright (C) 1998 Hrvoje Horvat
  9. ;
  10. ; This program is free software; you can redistribute it and/or modify
  11. ; it under the terms of the GNU General Public License as published by
  12. ; the Free Software Foundation; either version 2 of the License, or
  13. ; (at your option) any later version.
  14. ;
  15. ; This program is distributed in the hope that it will be useful,
  16. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18. ; GNU General Public License for more details.
  19. ;
  20. ; You should have received a copy of the GNU General Public License
  21. ; along with this program; if not, write to the Free Software
  22. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24. (define (apply-3d-outline-logo-effect img
  25.                       logo-layer
  26.                       text-pattern
  27.                       outline-blur-radius
  28.                       shadow-blur-radius
  29.                       bump-map-blur-radius
  30.                       noninteractive
  31.                       s-offset-x
  32.                       s-offset-y)
  33.   (let* ((width (car (gimp-drawable-width logo-layer)))
  34.          (height (car (gimp-drawable-height logo-layer)))
  35.          (bg-layer (car (gimp-layer-new img width height
  36.                     RGB-IMAGE "Background" 100 NORMAL-MODE)))
  37.          (pattern (car (gimp-layer-new img width height
  38.                        RGBA-IMAGE "Pattern" 100 NORMAL-MODE)))
  39.          (layer2)
  40.          (layer3)
  41.          (pattern-mask)
  42.          (floating-sel))
  43.  
  44.     (gimp-context-push)
  45.  
  46.     (gimp-selection-none img)
  47.     (script-fu-util-image-resize-from-layer img logo-layer)
  48.     (gimp-image-add-layer img pattern 1)
  49.     (gimp-image-add-layer img bg-layer 2)
  50.     (gimp-context-set-background '(255 255 255))
  51.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  52.     (gimp-edit-clear pattern)
  53.     (gimp-layer-set-preserve-trans logo-layer TRUE)
  54.     (gimp-context-set-foreground '(0 0 0))
  55.     (gimp-edit-fill logo-layer FOREGROUND-FILL)
  56.     (gimp-layer-set-preserve-trans logo-layer FALSE)
  57.     (plug-in-gauss-iir 1 img logo-layer outline-blur-radius TRUE TRUE)
  58.  
  59.     (gimp-drawable-set-visible pattern FALSE)
  60.     (set! layer2 (car (gimp-image-merge-visible-layers img CLIP-TO-IMAGE)))
  61.     (plug-in-edge 1 img layer2 2 1 0)
  62.     (set! layer3 (car (gimp-layer-copy layer2 TRUE)))
  63.     (gimp-image-add-layer img layer3 2)
  64.     (plug-in-gauss-iir 1 img layer2 bump-map-blur-radius TRUE TRUE)
  65.  
  66.     (gimp-selection-all img)
  67.     (gimp-context-set-pattern text-pattern)
  68.     (gimp-edit-bucket-fill pattern
  69.                PATTERN-BUCKET-FILL NORMAL-MODE 100 0 FALSE 0 0)
  70.     (plug-in-bump-map noninteractive img pattern layer2
  71.               110.0 45.0 4 0 0 0 0 TRUE FALSE 0)
  72.  
  73.     (set! pattern-mask (car (gimp-layer-create-mask pattern ADD-ALPHA-MASK)))
  74.     (gimp-layer-add-mask pattern pattern-mask)
  75.  
  76.     (gimp-selection-all img)
  77.     (gimp-edit-copy layer3)
  78.     (set! floating-sel (car (gimp-edit-paste pattern-mask FALSE)))
  79.     (gimp-floating-sel-anchor floating-sel)
  80.  
  81.     (gimp-layer-remove-mask pattern MASK-APPLY)
  82.     (gimp-invert layer3)
  83.     (plug-in-gauss-iir 1 img layer3 shadow-blur-radius TRUE TRUE)
  84.  
  85.     (gimp-drawable-offset layer3 0 1 s-offset-x s-offset-y)
  86.  
  87.     (gimp-drawable-set-visible layer2 FALSE)
  88.     (gimp-drawable-set-visible pattern TRUE)
  89.     ;;(set! final (car (gimp-image-flatten img)))
  90.  
  91.     (gimp-context-pop)))
  92.  
  93. (define (script-fu-3d-outline-logo-alpha img
  94.                      logo-layer
  95.                      text-pattern
  96.                      outline-blur-radius
  97.                      shadow-blur-radius
  98.                      bump-map-blur-radius
  99.                      noninteractive
  100.                      s-offset-x
  101.                      s-offset-y)
  102.   (begin
  103.     (gimp-image-undo-group-start img)
  104.     (apply-3d-outline-logo-effect img logo-layer text-pattern
  105.                   outline-blur-radius shadow-blur-radius
  106.                   bump-map-blur-radius noninteractive
  107.                   s-offset-x s-offset-y)
  108.     (gimp-image-undo-group-end img)
  109.     (gimp-displays-flush)))
  110.  
  111. (script-fu-register "script-fu-3d-outline-logo-alpha"
  112.                     _"3D _Outline..."
  113.                     "Creates outlined texts with drop shadow"
  114.                     "Hrvoje Horvat (hhorvat@open.hr)"
  115.                     "Hrvoje Horvat"
  116.                     "07 April, 1998"
  117.                     "RGBA"
  118.                     SF-IMAGE       "Image"               0
  119.                     SF-DRAWABLE    "Drawable"            0
  120.             SF-PATTERN    _"Pattern"             "Parque #1"
  121.                     SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1)
  122.                     SF-ADJUSTMENT _"Shadow blur radius"  '(10 1 200 1 10 0 1)
  123.                     SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1)
  124.             SF-TOGGLE     _"Default bumpmap settings" TRUE
  125.             SF-ADJUSTMENT _"Shadow X offset"     '(0 0 200 1 5 0 1)
  126.                     SF-ADJUSTMENT _"Shadow Y offset"     '(0 0 200 1 5 0 1))
  127.  
  128. (script-fu-menu-register "script-fu-3d-outline-logo-alpha"
  129.              _"<Image>/Script-Fu/Alpha to Logo")
  130.  
  131.  
  132. (define (script-fu-3d-outline-logo text-pattern
  133.                    text
  134.                    size
  135.                    font
  136.                    outline-blur-radius
  137.                    shadow-blur-radius
  138.                    bump-map-blur-radius
  139.                    noninteractive
  140.                    s-offset-x
  141.                    s-offset-y)
  142.   (let* ((img (car (gimp-image-new 256 256 RGB)))
  143.          (text-layer (car (gimp-text-fontname img -1 0 0 text 30 TRUE size PIXELS font))))
  144.     (gimp-image-undo-disable img)
  145.     (apply-3d-outline-logo-effect img text-layer text-pattern
  146.                   outline-blur-radius shadow-blur-radius
  147.                   bump-map-blur-radius noninteractive
  148.                   s-offset-x s-offset-y)
  149.     (gimp-image-undo-enable img)
  150.     (gimp-display-new img)))
  151.  
  152. (script-fu-register "script-fu-3d-outline-logo"
  153.                     _"3D _Outline..."
  154.                     "Creates outlined texts with drop shadow"
  155.                     "Hrvoje Horvat (hhorvat@open.hr)"
  156.                     "Hrvoje Horvat"
  157.                     "07 April, 1998"
  158.                     ""
  159.             SF-PATTERN    _"Pattern"             "Parque #1"
  160.                     SF-STRING     _"Text"                "The Gimp"
  161.                     SF-ADJUSTMENT _"Font size (pixels)"  '(100 2 1000 1 10 0 1)
  162.                     SF-FONT       _"Font"                "RoostHeavy"
  163.                     SF-ADJUSTMENT _"Outline blur radius" '(5 1 200 1 10 0 1)
  164.                     SF-ADJUSTMENT _"Shadow blur radius"  '(10 1 200 1 10 0 1)
  165.                     SF-ADJUSTMENT _"Bumpmap (alpha layer) blur radius" '(5 1 200 1 10 0 1)
  166.             SF-TOGGLE     _"Default bumpmap settings" TRUE
  167.             SF-ADJUSTMENT _"Shadow X offset"     '(0 0 200 1 5 0 1)
  168.                     SF-ADJUSTMENT _"Shadow Y offset"     '(0 0 200 1 5 0 1))
  169.  
  170. (script-fu-menu-register "script-fu-3d-outline-logo"
  171.              _"<Toolbox>/Xtns/Script-Fu/Logos")
  172.